Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #1881 - composite operation failing when track_total_hits is false #1882

Merged
merged 15 commits into from
Oct 29, 2024

Conversation

ugosan
Copy link
Contributor

@ugosan ugosan commented Oct 17, 2024

This PR addresses an issue (#1881) where a composite operation using async search fails when track_total_hits is set to false in the request. The failure occurs because the response does not include the hits.total field, causing a KeyError during the retrieval of async search results.

Changes:

  • Enforced "wait_for_completion_timeout": 0 which defaults to 1 second, causing async searches faster than 1 second to not have an id assigned, which would break the composite flow, with submit, get and delete all relying on an id.
  • Added checks to avoid accessing hits.total when track_total_hits is false.

commit 5746dc3
Author: Ugo Sangiorgi <ugo.sangiorgi@elastic.co>
Date:   Fri Oct 18 13:27:44 2024 -0500

    checking if total is reported (track_total_hits)

commit 6999097
Author: Ugo Sangiorgi <ugo.sangiorgi@elastic.co>
Date:   Fri Oct 18 13:26:58 2024 -0500

    enforcing wait_for_completion_timeout = 0 so there is always an id associated with the async search

commit 1086eaf
Author: Ugo Sangiorgi <ugo.sangiorgi@elastic.co>
Date:   Thu Oct 17 11:40:39 2024 -0500

    adding True as default for track_total_hits

commit 4c68e3a
Author: Ugo Sangiorgi <ugo.sangiorgi@elastic.co>
Date:   Thu Oct 17 11:14:10 2024 -0500

    fixes composite operation failing when track_total_hits is false
@ugosan ugosan enabled auto-merge (squash) October 18, 2024 19:48
@ugosan ugosan disabled auto-merge October 21, 2024 18:31
@gareth-ellis gareth-ellis requested a review from a team October 22, 2024 12:13
Copy link
Member

@gareth-ellis gareth-ellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far!

esrally/driver/runner.py Outdated Show resolved Hide resolved
esrally/driver/runner.py Outdated Show resolved Hide resolved
ugosan and others added 6 commits October 22, 2024 12:50
Co-authored-by: Gareth Ellis <gareth.ellis@elastic.co>
Co-authored-by: Gareth Ellis <gareth.ellis@elastic.co>
Co-authored-by: Gareth Ellis <gareth.ellis@elastic.co>
@ugosan ugosan requested a review from gareth-ellis October 23, 2024 13:50
Copy link
Member

@gareth-ellis gareth-ellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@gareth-ellis gareth-ellis added this to the 2.x milestone Oct 24, 2024
@ugosan ugosan merged commit 604cd67 into elastic:master Oct 29, 2024
17 checks passed
@favilo favilo added the bug Something's wrong label Nov 6, 2024
@favilo favilo modified the milestones: 2.x, 2.11.1 Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something's wrong
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants